<?php

namespace Drupal\shusy_store_order_extension\MetadataController;

use EntityDefaultMetadataController;

class ShusyStoreOrderExtensionMetadataController extends EntityDefaultMetadataController {

  public function entityPropertyInfo() {
    $info = parent::entityPropertyInfo();
    $properties = &$info[$this->type]['properties'];
    $properties['user'] = [
      'label' => t('所有人'),
      'type' => 'user',
      'schema field' => 'uid',
      'description' => t('所有人.'),
    ];
    $properties['op_user'] = [
      'label' => t('操作人'),
      'type' => 'user',
      'schema field' => 'op_uid',
      'description' => t('操作人.'),
    ];

    $properties['created'] = [
      'label' => t('记录时间'),
      'type' => 'date',
      'schema field' => 'created',
      'description' => t('记录时间.'),
    ];
    $properties['changed'] = [
      'label' => t('变化时间'),
      'type' => 'date',
      'schema field' => 'changed',
      'description' => t('变化时间.'),
    ];

    $properties['order'] = [
      'label' => t('订单'),
      'type' => 'shusy_store_order',
      'schema field' => 'store_order_id',
      'description' => t('order.'),
    ];
    $properties['point'] = [
      'label' => t('可获得积分数量'),
      'type' => 'integer',
      'schema field' => 'point',
      'description' => t('可获得积分数量.'),
      'setter callback' => 'entity_property_verbatim_set',
      'setter permission' => 'shusy_store_order_extension access create',
    ];
    $properties['pay_time'] = [
      'label' => t('付款时间'),
      'type' => 'date',
      'schema field' => 'pay_time',
      'description' => t('付款时间.'),
      'setter callback' => 'entity_property_verbatim_set',
      'setter permission' => 'shusy_store_order_extension access create',
    ];
    $properties['shipping_time'] = [
      'label' => t('发货时间'),
      'type' => 'date',
      'schema field' => 'shipping_time',
      'description' => t('发货时间.'),
      'setter callback' => 'entity_property_verbatim_set',
      'setter permission' => 'shusy_store_order_extension access create',
    ];
    $properties['complete_time'] = [
      'label' => t('成交时间'),
      'type' => 'date',
      'schema field' => 'complete_time',
      'description' => t('成交时间.'),
      'setter callback' => 'entity_property_verbatim_set',
      'setter permission' => 'shusy_store_order_extension access create',
    ];
    return $info;
  }
}
